Node registration is a mechanism that can improve performance with repeatedly accessed nodes. Your code can specify the nodes it plans to access, and doing so allows the server to prepare for that. The subsequent access (such as reading, writing, or method calls) to the registered nodes can then proceed in a more efficient manner.
The use of node registration is optional, and it does not influence the semantics of the program (i.e. the results you obtain - leaving aside the efficiency gain, and changes caused by different timing).
The features discussed here, or some of them, may not be available in all editions of the product. Check the
QuickOPC Product Editions page for differences between the editions. The trial license has all features enabled (and is limited in period for which it provides valid data), but licenses for specific commercial editions may have functionality limitations.
In OPC UA, you can register the nodes using the IEasyUAClientNodeRegistration service that you obtain from the EasyUAClient component.
- The RegisterMultipleNodes Method registers the nodes you specify with their target OPC UA servers, and returns a registration handle for each such node.
- The UnregisterMultipleNodes Method unregisters the previously registered nodes. You specify the nodes to be unregistered using the registration handles obtain when registering them.
By registering a node using the IEasyUAClientNodeRegistration Interface, you declare a permanent intent for the node to be registered while the connection to the target server is open, until you specifically perform the node un-registration using the registration handle obtained (which becomes invalid at that point). From the functional point of view, it is irrelevant whether the connection to the server is open at the time of RegisterMultipleNodes Method call, or not. If it is open, QuickOPC will perform the registration with the server at that time. If it is not open, QuickOPC will perform the registration as part of the process of opening the connection.
Besides usage errors (invalid arguments), the RegisterMultipleNodes Method and UnregisterMultipleNodes Method (and derived extension methods) do not report any other errors. If the node registration fails for whatever reason, the nodes will simply remain unregistered, but the program will continue to function normally. The common reasons for the node registration to fail might be that the OPC UA server does not support node registration, or (when it supports it) the particular node(s) that you are trying to register are not suitable for registration, or that a server has already reached its internal limit on how many nodes can be registered per session or globally. Consult the documentation of your OPC UA server to find out details about how it handles the node registration.
In some cases, it might be beneficial to combine the use of the node registration service with the QuickOPC Operation Control Services, and explicitly lock the connection to the target OPC server so that the components attempts to keep it open for some duration. There are two basic reasons to do that:
- If there are any nodes registered, internally, the OPC UA RegisterNodes service call is (has to be) made every time the OPC UA session is created. If you let QuickOPC maintain the connections automatically, the OPC UA session might be closed due to inactivity, and re-opening it will cause a new OPC UA RegisterNodes service call, and so on. Locking the connection assures that the OPC UA session is not closed unnecessarily.
- If you know upfront that some nodes will be accessed, but the actual access happens later, you may want that the connection is established and the OPC UA RegisterNodes service call is made early in your program, so that the actual subsequent access to the registered nodes can already use the registration made before. Locking the connection allows you to make sure that the OPC UA RegisterNodes service call is made at the right time, early enough.
.NET
Python
You can study the OPC UA specifications (Part 4 - Services) to obtain more information about the node registration. Keep in mind, however, that although the methods provided by the IEasyUAClientNodeRegistration Interface look similar to and ultimately end up calling the RegisterNodes and UnregisterNodes services in OPC UA, there are important and crucial differences between the functionality of the OPC UA services, and the approach taken by the IEasyUAClientNodeRegistration Interface. Specifically:
- The IEasyUAClientNodeRegistration Interface is connection-less, and persistent. You can register and unregister nodes independent of whether the connection to the target OPC UA server is currently open or not. If it is not open, QuickOPC will automatically make sure that the nodes will be registered when a session to the target OPC UA server is created. If the session becomes disconnected e.g. due to network disruptions or because it is no longer in use, QuickOPC will re-register the nodes with the OPC UA server upon reconnection as needed.
- With the IEasyUAClientNodeRegistration Interface, you can address nodes residing on different servers (endpoint) in one call. QuickOPC will sort it out, and perform the operations on different servers in parallel.
- With the IEasyUAClientNodeRegistration Interface, your code does not use the "transcribed", registered node Ids, for efficient access to registered nodes. The node Id transcription is done internally by QuickOPC. In fact, you do not get access to the "transcribed", registered node Ids, through the IEasyUAClientNodeRegistration Interface at all.
- When unregistering nodes using the IEasyUAClientNodeRegistration Interface, you do not specify the node Id again. Instead, you use the registration handle, returned from the registration method.
- You can safely register the same node multiple times using the IEasyUAClientNodeRegistration Interface, and unregister it one by one. QuickOPC keeps a usage counter for each registered node, and only performs the actual unregistration when the usage counter reaches zero. This is in contrast with the OPC UA UnregisterNodes service behavior, with which unregistering a node always results in it being unregistered, potentially disrupting the intent of other code which may have registered the same node as well.
- QuickOPC automatically splits the calls to OPC UA RegisterNodes and UnregisterNodes services to multiple subsequent invocations, if the target OPC UA server has an operation limit that limits the number of elements allowed per one RegisterNodes or UnregisterNodes call.
- No need for error handling - this is taken care of internally in the IEasyUAClientNodeRegistration Interface implementation.
- The operations taken by the methods on the IEasyUAClientNodeRegistration Interface may proceed asynchronously.
In .NET, there are also extensions methods on the IEasyUAClientNodeRegistration Interface, provided by the IEasyUAClientNodeRegistrationExtension Class. In COM, some of these methods are directly accessible on the _EasyUAClientNodeRegistration Interface. You can, for example, easily register or unregister just one node, using the RegisterNode Method and UnregisterNode Method, and there are also methods that provide additional useful overloads to other methods. Note that for performance, if you have more nodes to register or unregister, it is strongly recommended to use RegisterMultipleNodes Method and UnregisterMultipleNodes Method, instead of repeatedly calling the methods that register or unregister a single node.
See Also
Reference
Examples - Client OPC UA Services
Web
Examples - Client OPC UA Specialized